package hn.cch.web.request.controller;

import hn.cch.web.request.property.CustomExampleEditor;
import hn.cch.web.request.property.CustomExampleEntity;
import hn.cch.web.request.property.CustomRequestEntity;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/example")
@RestController
public class ExampleController {

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(CustomExampleEntity.class, new CustomExampleEditor());
    }

    @GetMapping("/getCustomRequestEntity")
    public CustomRequestEntity getCustomRequestEntity(CustomRequestEntity customRequestEntity) {
        return customRequestEntity;
    }

}
